{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
    
    <form class="layui-form layui-form-pane">
        <input type="hidden" name="order_id" id="" value="{$list.order_id}">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>订单信息</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">订单编号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.order_number}"
                     placeholder="请输入订单编号" class="layui-input">
            </div>
        </div>
       
        <div class="layui-form-item">
            <label class="layui-form-label">房间分类</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.one_cate==0?'过夜房':'钟点房'}-{$list.two_cate}"
                    class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">房间类型</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.is_activity==0?'普通房':'活动房'}"
                    class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">入住天数</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.days}" 
                    placeholder="请输入入住天数" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">下单时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" value="{:date('Y-m-d',$list.addtime)}" disabled  class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">支付时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{:date('Y-m-d',$list.paytime)}" placeholder="请输入入住天数"
                    class="layui-input">
            </div>
        </div>

        
        <div class="layui-form-item">
            <label class="layui-form-label">支付方式</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled
                    value="{$list.type==0?'微信支付':''}{$list.type==1?'次卡支付':''}{$list.type==2?'余额支付':''}"
                    class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">下单金额</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.money}" 
                    class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">入住时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{:date('Y-m-d',$list.in_time)}" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">离店时间</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{:date('Y-m-d',$list.out_time)}" class="layui-input">
            </div>
        </div>
        <fieldset class="layui-elem-field layui-field-title">
            <legend>发票信息</legend>
        </fieldset>

        <div class="layui-form-item">
            <label class="layui-form-label">发票状态</label>
            <div class="layui-input-inline">
                <select lay-filter="status" lay-search id="category" disabled>
                    <option value="0" {if $list.invoice_status==0}selected{/if}>未开发票</option>
                    <option value="1" {if $list.invoice_status==1}selected{/if}>已开发票</option>
                </select>
            </div>
        </div>


        
        {volist name="list['userlist']" id='vo' key="key"}
            
        <fieldset class="layui-elem-field layui-field-title">
            <legend>用户信息登记{$key}</legend>
        </fieldset>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$vo.name}" 
                    placeholder="请输入姓名" class="classname layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$vo.phone}" 
                    placeholder="请输入手机号" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">性别</label>
            <div class="layui-input-4">
                <input type="radio" disabled class="radeo" value="1" title="男" {if $vo.sex==1 }checked{/if}>
                <input type="radio" disabled class="radeo"  value="2" title="女" {if $vo.sex==2 }checked{/if}>
                <input type="radio" disabled class="radeo"  value="3" title="未知" {if $vo.sex==3 }checked{/if} disabled >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">身份证号</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled  value="{$vo.idcard}"
                    placeholder="请输入身份证号" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">联系地址</label>
            <div class="layui-input-4">
                <input type="text" disabled maxlength="200"  value="{$vo.address}" 
                    placeholder="请填写联系地址" class="layui-input"  >
            </div>
        </div>

        {/volist}
        <div class="layui-form-item">
            <label class="layui-form-label">申款类型</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.refund_type}"
                    placeholder="退款类型" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">退款原因</label>
            <div class="layui-input-4">
                <input type="text" maxlength="200" disabled value="{$list.refund_note}"
                     placeholder="申请退款详情" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">是否同意</label>
            <div class="layui-input-inline">
                <select name="status" {if $list.status==3 || $list.status==4}disabled{/if} lay-filter="status" lay-search id="category">
 
                    {if $list.status==2}
                    <option value="2" {if $list.status==2}selected{/if}>申请退款（请谨慎操作）</option>
                    {/if}
                    {if $list.status==3 || $list.status==2}
                    <option value="3" {if $list.status==3}selected{/if}>审核通过</option>
                    {/if}
                    {if $list.status==2 || $list.status==4}
                    <option value="4" {if $list.status==3}selected{/if}>审核驳回</option>
                    {/if}
                </select>
                
            </div>
            <div class="layui-form-mid layui-word-aux">一旦选择不能重新选择，请谨慎选择</div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">审核说明</label>
            <div class="layui-input-4">
                <textarea name="check_reason" lay-verify="required" class="layui-textarea" {if $list.status!=2}disabled{/if} >{$list.check_reason}</textarea>
            </div>
            <div class="layui-form-mid layui-word-aux">审核回复</div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                {if $list.status==2}
                <button type="button" class="layui-btn" id="submit" lay-submit="" lay-filter="sys">{:lang('submit')}</button>
                  {/if}  
                    <button type="button" class="layui-btn" id="udit" lay-submit="" lay-filter="gotu">返回</button>
            </div>
        </div>




    </form>
</div>
{include file="common/foot"/}
<script>
    layui.use(['form', 'layer', 'upload'], function () {
        var form = layui.form, layer = layui.layer, upload = layui.upload, $ = layui.jquery;
        form.verify({
            title: function (value) {
                if (value == '') {
                    return '请输入优惠券分类名称!';
                }
            },
        });
        form.render()
        form.on('submit(gotu)',function(data){
            location.href = '{:url("index")}';
        })
        form.on('submit(sys)', function (data) {
            $("#submit").attr({ disabled: "disabled" });
            loading = layer.load(1, { shade: [0.1, '#fff'] });
            // console.log(data.field);
            if(data.field.status==2){
                layer.msg('请选择订单状态',{icon:2,time:1000})
                layer.close(loading);
                return false
                
            }
            if(data.field.status==4){
                $.post("{:url('refund/reject')}", data.field, function (res) {
                    layer.close(loading);
                    if (res.code == 1) {
                        layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                            location.href = '{:url("index")}';
                        });
                    } else {
                        $("#submit").removeAttr("disabled");
                        layer.msg(res.msg, { icon: 2, time: 1000 });
                    }
                });
            }else{
                $.post("{:url('refund/pass')}", data.field, function (res) {
                    layer.close(loading);
                    if (res.code == 1) {
                        layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                            location.href = '{:url("index")}';
                        });
                    } else {
                        $("#submit").removeAttr("disabled");
                        layer.msg(res.msg, { icon: 2, time: 1000 });
                    }
                });
            }
           
        })
    })
</script>
</body>
</html>